import {messageInfo} from "./MessageInfo";
import el from "element-ui/src/locale/lang/el";


/**
 * 结果信息处理
 * @param res 数据
 * @param isShowMessage 是否弹窗
 * @returns {*}
 */
export const resultCheck = (res, isShowMessage = false) => {
    if (isShowMessage) {
        if (res.status) {
            messageInfo({type:"success", message: res.message + " ==> " + res.data});
        }else{
            messageInfo({type:"error", message: res.message + " ==> " + res.data});
        }
    }
    return res.data;
};

/**
 * 将一个对象信息解析为字符串
 * @param obj 待解析的对象
 * @returns {string} 对象的字符串
 */
function printObject(obj) {
    var description = "";
    for (var i in obj) {
        var property = obj[i];
        description += i + " = " + property + "\n";
    }
    return description;
}